package com.example.deertrip;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.RadioGroup;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.Toast;

import com.example.deertrip.bean.Tb_UserInfo;
import com.example.deertrip.database.DBOperate;


public class login_useregister_activity extends AppCompatActivity{
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.login_useregister);

        EditText Name;
        Name=(EditText) findViewById(R.id.EditText1UserName);

        EditText PassWord ;
        PassWord=(EditText) findViewById(R.id.EditText2UserPassword);

        EditText Address;
        Address=(EditText) findViewById(R.id.EditText3UserAddress);

        EditText Tel ;
        Tel=(EditText) findViewById(R.id.EditText4UserTel);

        Button user_zhuce_wancheng1;
        user_zhuce_wancheng1=(Button) findViewById(R.id.user_zhuce_wancheng);

        user_zhuce_wancheng1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String name=Name.getText().toString().trim();
                String pass=PassWord.getText().toString().trim();
                String addr=Address.getText().toString().trim();
                String tele=Tel.getText().toString().trim();
                Log.i("TAG",name+"_"+pass+"_"+addr+"_"+tele);
                DBOperate operate=new  DBOperate(login_useregister_activity.this);
                Tb_UserInfo user=new Tb_UserInfo(name,pass,addr,tele);
                user.setUserName(name);
                user.setUserPassword(pass);
                user.setUserAddress(addr);
                user.setUserTel(tele);
                operate.register(user);

                //注册成功跳转
                Toast.makeText(login_useregister_activity.this, "注册成功", Toast.LENGTH_LONG).show();
                Intent intent=new Intent( login_useregister_activity.this, login_user_Activity.class);
                startActivity(intent);
            }


        });


    }


}
